<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <title>51问医生</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    {{--<link rel="shortcut icon" href="/Public/mobile/favicon.ico" type="image/x-icon" />--}}
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="yes"/>
    <script src="{{url('/js/jquery.min.js')}}" type="text/javascript"></script>
    <link rel="stylesheet" href="{{url('new/css/common.css')}}" />

    <script src="{{url('new/js/doctor_list.js')}}"></script>
    {{--<script src="http://mcdn.anxinyisheng.com/Public/mobile/js/lib_5d2f194.js"></script>--}}
    {{--<script src="http://mcdn.anxinyisheng.com/Public/mobile/js/app_7282afb.js"></script>--}}
    <link rel="stylesheet" href="{{url('new/css/mianzhen.css')}}" />

    <!-- Noty 提示框的js集成 -->
    <script src="{{ url('vendor/noty-2.2.9/packaged/jquery.noty.packaged.js') }}"></script>
    <script src="{{ url('vendor/noty-2.2.9/themes/bootstrap.js') }}"></script>
    <script src="{{ url('vendor/noty-2.2.9/options.js') }}"></script>
</head>
<body>
<div class="appt">
    <div class="docInfo-wrapper ax-boxshadow">
        <div class="icon-cover">
            <img class='doctor-icon' src="@if($doctor){{route('Api.Image.Show',['id'=>$doctor->doc_img])}}@else{{route('Api.Image.Show',['id'=>0])}}@endif" ng-src="doctor.icon"></div>
        <div class="doc-info-box">
            <div class="name">@if($doctor){{$doctor->doc_name}} @endif</div>
            <div class="hospital">@if($doctor){{$doctor->hospital}}@endif</div>
            <div class="position">@if($doctor){{$doctor->subject}}，{{$doctor->station}}@endif</div></div>
    </div>
    <div class="vipcontent ax-boxshadow">
        <div class="ax-twopart-desc appt-desc">
            <span class="left">服务：</span>
            <span class="right">一对一专家面诊</span>
      {{--<span class="explain" ng-if="!isShowPolicy" ng-click="showPolicy()">--}}
        {{--<svg class="policy-icon">--}}
            {{--<use xlink:href="#explain"></use>--}}
        {{--</svg>--}}
      {{--</span>--}}
        </div>
        <div class="vipline"></div>
        <div class="ax-twopart-desc appt-price">
            <span class="left leftP">费用：</span>
            {{--<span class="left leftP" ng-if="isEliza">定金：</span>--}}
      <span class="right">
        <span class="price-num">￥@if($doctor){{$doctor->fee_face}} @endif
            <!-- <i ng-if="price < origPrice && price !==0 ">(限时特惠)</i> <i ng-if="price < origPrice && price == 0">(限时免费)</i> --></span>
            {{--<span class="origPrice" ng-if="price < origPrice && !isEliza">原价:￥origPrice</span>--}}
        </span>
        </div>
        <!--<div class="ax-twopart-desc appt-info"> <span class="info-left"><svg><use xlink:href="#explain"></use></svg></span> <span class="info-right"> 价格为专家会诊服务费，不含药品，检查和其他治疗费用</span> </div>--></div>
    <div class="vipcontent ax-boxshadow">
        <div class="ax-twopart-desc appt-time">
            <span class="left">时间：</span>
            <span class="right">
                @if(!is_null($day) && $day !== '')
                    {{date('Y-m-d',$day)}}
                    @if(!is_null($day_time) && $day_time == 'am')
                        <em style="margin-left:3px;color: #c2917d">上午</em>
                    @else
                        <em style="margin-left:3px;color: #c2917d">下午</em>
                    @endif
                @else
                    请选择咨询时间
                @endif
            </span>
            <input type="hidden" id="day" value="@if($day && !is_null($day)){{date('Y-m-d',$day)}}@endif">
            <input type="hidden" id="day_time" value="@if(!is_null($day_time)){{$day_time}}@endif">
            {{--<span ng-if="!hasSchedules&&!curTimeFlag" class="right">医生本周暂无可约时间</span>--}}
            {{--<span ng-if="hasSchedules&&noAmount&&!curTimeFlag" class="right">医生本周已约满</span>--}}
            {{--<span ng-if="curTimeFlag" class="right gotTime">curTimeForShow</span>--}}
            {{--<span ng-if="!curTimeFlag" class="time-arrow">--}}
            {{--<svg>--}}
            {{--<use xlink:href="#arrow_right"></use>--}}
            {{--</svg>--}}
            {{--</span>--}}
            <a href="{{route('M.Home.newFaceTime')}}?doc_id={{$doctor->user_id}}">
                <span class="time-arrow time-arrowRe">点击设置</span>
            </a>
        </div>
            <div class="appt-attr-wrapper">
                <p>地址：@if($doctor){{$doctor->hospital}}-{{$doctor->subject}}@endif</p>
            </div>
    </div>
    <div class="vipcontent ax-boxshadow">
        <div class="ax-twopart-desc appt-link">
            <span class="left">联系方式：</span>
      <span class="right">
        <input placeholder="请输入手机号码" id="mobile" type="text" value="@if($userinfo){{$userinfo->phone}}@endif" /></span>
            <span class="time-arrow time-arrowRe">可修改</span></div>
    </div>
 </div>
<div class="payBtn">
    <div class="pay-desc">
        <span class="payBtn-realprice">实付金额：</span>
        <i>
            <span>￥</span>@if($doctor){{$doctor->fee_face}} @endif
        </i>
        {{--<p class="tip">限时免费（就诊后全额退还定金)</p>--}}
    </div>
    <div class="clickPay">
        <div class="btn ax-bareBtn">
            <button class="start-chat" id="btn_pay">
                <span class="start-chat-text">微信支付</span>
            </button>
        </div>
    </div>
</div>
<script>
    $(function(){
        $(document).on('click','#btn_pay',function(){
            var phone   = $('#mobile').val();
            var day     = $('#day').val();
            var dayTime = $('#day_time').val();
            if(phone.length !== 11){
                noty({type:'error',text:'请正确输入联系手机号',timeout:800});
                return ;
            }
            if(day.length <= 0){
                noty({type:'error',text:'请正确选择面诊时间',timeout:800});
                return ;
            }

            $.ajax({

                type:"post",
                url:'{{route('Api.YiLiao.submitDoctorBespoke')}}',
                dataType:"json",
                data:{
                    'phone':phone,
                    'doc_id':"{{$doctor->user_id}}",
                    'slot':dayTime,
                    'time':day,
                    'type':'face'
                },
                success:function(obj){
                    if(obj.level == "success"){
                        $.post('/api/wechat/wpay',{
                            order_num:obj.data.order_num
                        },function(data,res){
                            WXPayment(data.data);
                        });

                    }
                },
                error:function(obj){
                    var datajson = obj.responseJSON;
                    noty({text:datajson.message,type:datajson.level,timeout:800,
                        callback:{
                            afterClose:function(){
                                location.reload();
                            }
                        }
                    });
                }
            });
        });

        function WXPayment(configJSON) {
            if (typeof WeixinJSBridge === 'undefined') {
                alert('请在微信在打开页面！');
                return false;
            }
            WeixinJSBridge.invoke('getBrandWCPayRequest', configJSON, function (res) {
                switch (res.err_msg) {
                    case 'get_brand_wcpay_request:cancel':
                        alert('用户取消支付！');
                        break;
                    case 'get_brand_wcpay_request:fail':
                        alert('支付失败！（' + res.err_desc + '）');
                        break;
                    case 'get_brand_wcpay_request:ok':
                        noty({text:'支付成功',type:'success',timeout:600,
                            callback:{
                                afterClose:function(){
                                    window.location.href='{{route('M.Home.orderList')}}';
                                }
                            }
                        });
                        break;
                    default:
                        alert(JSON.stringify(res));
                        break;
                }
            });
        }
    });
</script>
{{--<div class="appt-policy" ng-class="{'showPolicy':isShowPolicy}" ng-click="closePolicy()" ng-if="!isEliza">--}}
{{--<div class="appt-policy isShowPolicy" >--}}
    {{--<span class="triangle">服务说明</span>--}}
    {{--<p>①--}}
        {{--<span>价格为专家会诊服务费，不含药品，检查和其他治疗费用</span></p>--}}
    {{--<p>②--}}
        {{--<span>如遇医生时间临时调整，安心医生会尽早通知您与您协调时间</span></p>--}}
    {{--<p>③--}}
        {{--<span>如预约医生不成功或由时间变更使得您无法咨询，您预约医生支付的费用将自动退回到患者账户中，可在付款查询中查看</span></p>--}}
    {{--<p>④--}}
        {{--<span>预约时间前24小时之前取消，所支付服务费将全额退还。预约时间前24小时内取消，需扣除50元保证金</span></p>--}}
    {{--<div class="policy-line"></div>--}}
    {{--<p class="caution">如您在约定时间内未能联系上预约医生，请第一时间致电客服--}}
        {{--<a serviceNumber></a>，安心医生会在第一时间为您提供帮助.</p>--}}
    {{--<div class="closePolicy">--}}
        {{--<svg>--}}
            {{--<use xlink:href="#close"></use>--}}
        {{--</svg>--}}
    {{--</div>--}}
{{--</div>--}}
</body>
</html>